var publicJs = require("../../../../public.js");

Page({
  data: {},
  onLoad: function (options) {
    var that = this;
    that.setData({
      flag: options.flag
    })
    publicJs.JsonPost("News/getNewsListByFlag", {
      flag: this.data.flag
    }, function (res) {
      console.log(res);
      wx.setNavigationBarTitle({
        title: res.cateInfo.cate_name//页面标题为路由参数
      });
      that.setData({
        newslist: res.newsList.data
      });
    })
  },
  newsDetail: function (e) {
    var newsid = e.currentTarget.id;
    wx.navigateTo({ url: "detail?newsId=" + newsid })
  }
})